<template>
  <div class="EmergencyList">
    <div class="flex location-wrap">
      <span class="white">当前位置：</span>
      <el-breadcrumb separator="/">
        <el-breadcrumb-item :to="{ path: '/EWManagement' }">预警管理</el-breadcrumb-item>
        <el-breadcrumb-item>调整及解除</el-breadcrumb-item>
      </el-breadcrumb>
    </div>
    <div class="box">
      <!-- 列表筛选 -->
      <filterTitle @query="query" @reset="reset" :form="form" :formData="formData" @change="change"
        @node-click="handleSelectTree">
      </filterTitle>
      <!-- 列表表格 -->
      <LsdTable slot="yjxdlb" :paginationAtrrs="config.table.paginationAtrrs" :compRef="config.table.compRef" ref="yjxdlb"
        :columns="config.table.columns" :title="config.table.title" :actions="config.table.actions"
        :tableData="config.table.tableData" :tableAttr="config.table.tableAttr" :isShowPage="config.table.isShowPage"
        :isSelectFlag="config.table.isSelectFlag" :isSequenceFlag="config.table.isSequenceFlag"
        @pageChange="handleSizeChange" @onActionClick="onActionClick" />
    </div>
    <!-- 新增弹窗信息 -->
    <LsdDialog @handleBtn="onActionClick" :dialogConfig="dialogConfig" @close="close(dialogConfig)">
      <LsdDialogTitle slot="dialog" :titleConfig="titleConfig" :activeNames="activeNames">
        <DialogForm @handleNodeClick="handleNodeClick" @removeTag="removeTag" ref="formComponent" slot="slot1"
          @pickerChange="pickerChange" :formConfig="formConfig" />
        <LsdTable :autoHeight="config.table1.autoHeight" slot="slot2"
          :formLabel="['sp', 'jc'].includes(dialogConfig.type) ? config.table1.formLabel1 : config.table1.formLabel"
          :compRef="config.table1.compRef" ref="xzdw"
          :columns="['sp', 'jc'].includes(dialogConfig.type) ? config.table1.columns1 : config.table1.columns"
          :title="config.table1.title" :actions="config.table1.actions" :tableData="config.table1.tableData"
          :tableAttr="config.table1.tableAttr" :isShowPage="config.table1.isShowPage"
          :isSelectFlag="config.table1.isSelectFlag" :isSequenceFlag="config.table1.isSequenceFlag"
          @onActionClick="onActionClick" />
        <DialogForm ref="formComponent1" slot="slot3" :formConfig="formConfig1" />
        <DialogForm ref="formComponent2" slot="slot4" :formConfig="formConfig2" />
        <DialogForm ref="formComponent3" slot="slot5" :formConfig="formConfig3" />
      </LsdDialogTitle>
    </LsdDialog>
    <!-- 预览 -->
    <LsdDialog :dialogConfig="dialogConfig1" @close=close(dialogConfig1) @handleBtnX="handleBtnX" @handleBtnD="tzdPrint">
      <Preview slot="dialog" :id="id" :previewVisible.sync="dialogConfig1.isShow" />
    </LsdDialog>
  </div>
</template>

<script>
// warningNotificationSubmitadjustSubmit,
import { adjustSubmit, sameLeveltree, listPage, getPersonApi, getSubclassUntilList, getSubclassUntilLists, getOrgDepartmentList, adjust, warningNotificationUpdById, warningNotificationApprove, relieve, deleteById, detailList, getIssueJudgeData, warningNotificationAdjustApprove } from "@/api/EarlyWarningManagement/yjtzd";
import { getCityTree } from "@/api/EarlyWarningManagement/yjxxsj";
import { getDictByGroup } from "@/api/common.js";
import Preview from "@/views/EarlyWarningManagement/EWNotice/components/Preview";
// import { getUnitTreeApi } from "@/api/EarlyWarningManagement/yjrb";
import { flowSubmit } from "@/utils/flow";
import Printer from "@/utils/operationTicketPrint";
export default {
  components: { Preview },
  data() {
    return {
      noticeState: "",
      number: 0,
      id: "",
      zrbmOption: [],
      config: {},
      form: {},
      rules: {
        useUserName: [
          { required: true, message: "请输入领用人", trigger: "blur" }
        ]
      },
      // 弹窗信息
      dialogConfig: {
        title: "",
        isShow: false,
        type: "add",
        btnList: []
      },
      // 预览信息
      dialogConfig1: {
        title: "预警通知单",
        isShow: false, // 弹窗显示隐藏
        btnLists: [
          {
            name: "../assets/xiaziai.png",
            id: "BSubmit", // 事件名
            type: "primary",
            size: "mini"
          },
          {
            name: "../assets/daya.png",
            id: "submitForm",
            type: "primary",
            size: "mini"
          }
        ]

      },
      DetailList: {},
      // 折叠面板
      titleConfig: [],
      activeNames: ["1", "2", "3", "4", "5"],
      // 筛选条件
      formData: [
        {
          elType: "input",
          // id: "warningInfo",
          id: "warningNoticeName",
          label: "预警通知单",
          attrs: {
            value: "",
            size: "small",
            clearable: true,
            filterable: true,
            "collapse-tags": true
          }
        },
        {
          elType: "select",
          id: "dangerCode",
          label: "险情类别",
          dic: "dic_xqlb",
          attrs: {
            value: "",
            size: "small",
            clearable: true,
            filterable: true,
            "collapse-tags": true
          },
          options: []
        },
        {
          elType: "select",
          id: "warningLvCode",
          label: "预警级别",
          dic: "dic_yjjb",
          attrs: {
            value: "",
            clearable: true,
            size: "small",
            filterable: true,
            "collapse-tags": true
          },
          options: []
        },
        {
          elType: "input",
          id: "effectRange",
          label: "影响范围",
          attrs: {
            value: "",
            size: "small",
            clearable: true,
            filterable: true,
            "collapse-tags": true
          }
        },
        {
          elType: "dateTimePicker",
          id: "yxsj",
          label: "影响时间",
          attrs: {
            value: "",
            clearable: true,
            size: "small",
            type: "datetimerange",
            "start-placeholder": "开始日期",
            "end-placeholder": "结束日期",
            "value-format": "yyyy-MM-dd HH:mm:ss"
          }
        },
        {
          elType: "lsdTree",
          id: "approvalUnit",
          name: "approvalUnitId",
          label: "发布单位",
          treeRef: "treeRef",
          keyWord: "keyWord",
          commonClick: true,
          attrs: {
            value: "",
            size: "small",
            clearable: true,
            filterable: true,
            "collapse-tags": true
          },
          options: {
            attrs: {
              value: ""
            }
          },
          treeData: {
            attrs: {
              data: []
            },
            props: {
              children: "children",
              label: "orgName",
              value: "id"
            }
          }
        },
        {
          elType: "dateTimePicker",
          id: "approvalTime",
          label: "发布时间",
          attrs: {
            value: "",
            size: "small",
            clearable: true,
            type: "datetimerange",
            "start-placeholder": "开始日期",
            "end-placeholder": "结束日期",
            "value-format": "yyyy-MM-dd HH:mm:ss"
          }
        },
        {
          elType: "select",
          id: "noticeState",
          label: "状态",
          attrs: {
            value: "",
            size: "small",
            clearable: true,
            filterable: true,
            "collapse-tags": true
          },
          options: [
            // {
            //   label: "编辑中",
            //   value: "0"
            // },
            {
              label: "待审批",
              value: "1"
            },
            {
              label: "驳回",
              value: "2"
            },
            {
              label: "已发布",
              value: "3"
            },
            {
              label: "已解除",
              value: "4"
            },
            {
              label: "转响应",
              value: "5"
            }
          ]
        }
      ],
      formConfig: {
        formData: [],
        rules: {}
      },
      formConfig1: {
        formData: [],
        rules: {}
      },
      formConfig2: {
        formData: [
          {
            type: "input",
            label: "填报人",
            prop: "creator",
            class: "third",
            lableWidth: "140px",
            isDisabled: true
          },
          {
            type: "input",
            label: "单位及部门",
            prop: "createDeptName",
            class: "third",
            lableWidth: "140px",
            isDisabled: true
          },
          {
            type: "dataPicker",
            label: "填报时间",
            prop: "createTime",
            class: "third",
            lableWidth: "140px",
            dateType: "datetime",
            isDisabled: true
          }
        ]
      },
      formConfig3: {
        formData: [
          {
            type: "input",
            label: "审批意见",
            prop: "approvalOpinion",
            class: "sjgy",
            lableWidth: "140px",
            isDisabled: false
          },
          {
            type: "input",
            label: "审批人",
            prop: "approvalUser",
            class: "third",
            lableWidth: "140px",
            isDisabled: true
          },
          {
            type: "input",
            label: "单位及部门",
            prop: "approvalDept",
            class: "third",
            lableWidth: "140px",
            isDisabled: true
          },
          {
            type: "dataPicker",
            label: "审批时间",
            prop: "approvalTime",
            class: "third",
            lableWidth: "140px",
            dateType: "datetime",
            isDisabled: true
          }
        ]
      },
      judgeId: "",
      infoId: "",
      infoIds: "",
      rangeInfo: []// 影响范围
    };
  },
  watch: {
    "$route.query.eventState": {
      handler() {
        this.getList();
      },
      deep: true
    },
    "$route.query.noticeState": {
      handler() {
        this.getList();
      },
      deep: true
    }
    // "$route.query.id": {
    //   handler(val) {
    //     if (val) {
    //       if (this.$route.query.type === 1) {
    //         this.actionHandle("调整");
    //       } else if (this.$route.query.type === 2) {
    //         this.actionHandle("解除");
    //       }
    //     }
    //   }
    // }
  },
  created() {
    this.config = require(`./config`).default.config(this);
    // this.getUnitTree();
    this.getInputVal();
    this.getList();
    if (this.$route.query.id) {
      if (this.$route.query.type == 1) {
        this.actionHandle("调整");
      } else if (this.$route.query.type == 2) {
        this.actionHandle("解除");
      }
    }
  },
  methods: {
    // 打印
    tzdPrint() {
      detailList({ id: this.id }).then(res => {

        getIssueJudgeData({ id: res.judgeId }).then(data => {
          const readerFun = () => {
            // const formData = {};
            const html = Printer.assembleDomHtml(res, 0, data);
            return html;
          };
          window.open("").document.write(Printer.printerOperationTicket(readerFun));
        });

      });


    },
    // 下载
    handleBtnX() {
      // doDownPdf({ noticeId: this.id }).then(res => {
      //   // common.downloadByBlob(res, `车辆台账模板${new Date().getTime()}.xlsx`);
      // });

    },
    // 工作流提交
    gzlSubmit(bizKey, variable) {
      const data = {
        bizKey,
        flowKey: "warning_notification_001",
        taskId: "task1",
        callbackUrl: "/warning/warningNotification/handleFlow",
        idea: "1",
        variable
      };
      const successCallBack = () => {
        this.$message({
          message: "提交成功",
          type: "success"
        });
        this.getList();
        this.dialogConfig.isShow = false;
      };
      flowSubmit(data, successCallBack, "提交", true);
    },
    // 工作流审批
    gzlAudit(type, variable) {
      const data = {
        bizKey: this.id,
        flowKey: "warning_notification_001",
        taskId: "task2",
        callbackUrl: "/warning/warningNotification/handleFlow",
        idea: type === 3 ? "1" : "0",
        variable,
        ideaMsg: this.$refs.formComponent3.form.approvalOpinion ? this.$refs.formComponent3.form.approvalOpinion : type === 3 ? "同意" : "驳回"
      };
      const successCallBack = () => {
        this.$message({
          message: `${type === 3 ? "审核" : "驳回"}成功`,
          type: "success"
        });
        this.getList();
        this.dialogConfig.isShow = false;
      };
      flowSubmit(data, successCallBack, "审核");
    },
    handleSelectTree(arg, item) {
      if (item.id === "approvalUnit") {
        this.$set(this.form, "approvalUnitId", arg[0].id);
        this.$set(this.form, "approvalUnit", arg[0].orgName);
      }
    },
    // 树状
    async getOrgTree() {
      // const res = await getUnitTreeApi();
      this.formConfig1.formData.forEach((item) => {
        // 树状  派发单位/部门
        if (item.prop === "unitName") {
          getSubclassUntilList({ orgId: JSON.parse(sessionStorage.getItem("org")).orgId }).then(res => {
            item.treeData.data = res;
          });
        }
      });
      this.formConfig1.formData.forEach((item) => {
        // 树状  派发单位/部门
        // if (item.prop === "deptName") {
        //   getOrgDepartmentList({ orgId: JSON.parse(sessionStorage.getItem("org")).orgId }).then(res => {
        //     item.treeData.data = res;
        //   });
        // }
      });
      // this.formConfig1.formData[0].treeData.data = res;
      // this.formConfig1.formData[1].treeData.data = res;
    },
    // 影响范围树
    getUnitTree() {
      getCityTree().then(res => {
        this.formConfig.formData[3].treeData.data = res;
      });
    },
    // 影响范围
    handleNodeClick(data, node, item) {
      if (item.label === "影响范围") {
        const result = this.$refs.formComponent.form.effectRange;
        const datas = data.children || [];
        // if (node.parent.data instanceof Array) {
        if (datas.length > 0) {
          if (result.includes(data.extName)) return;
          else {
            this.$refs.formComponent.form.effectRange.push(data.extName);
            this.$refs.formComponent.form.geo.push(data.geo);
            const obj = { effectRange: data.extName, locationId: data.id, geo: data.geo, locationDeep: Number(data.deep) };
            this.rangeInfo.push(obj);
          }
        } else {
          if (result.includes(`${node.parent.data.extName}${data.extName}`) || result.includes(`${data.extName}`)) return;
          else {
            if (node.parent.data.extName) {
              this.$refs.formComponent.form.effectRange.push(`${node.parent.data.extName}${data.extName}`);
              const obj = { effectRange: `${node.parent.data.extName}${data.extName}`, locationId: data.id, geo: data.geo, locationDeep: Number(data.deep) };
              this.rangeInfo.push(obj);
            } else {
              const obj = { effectRange: `${data.extName}`, locationId: data.id, geo: data.geo, locationDeep: Number(data.deep) };
              this.$refs.formComponent.form.effectRange.push(`${data.extName}`);
              this.rangeInfo.push(obj);
            }
            this.$refs.formComponent.form.geo.push(data.geo);
          }
        }
      }
    },
    // 多选删除
    removeTag(val) {
      this.rangeInfo.splice(this.rangeInfo.findIndex(item => item.effectRange === val), 1);
    },
    // 列表接口
    getList(data) {
      let parmas = {
        pageNum: this.config.table.paginationAtrrs["current-page"],
        pageSize: this.config.table.paginationAtrrs["page-size"],
        noticeState: this.$route.query.noticeState || "",
        roleCode: JSON.parse(sessionStorage.getItem("role")).roleCode,
        flowKey: "warning_notification_001",
        type: "0"
      };
      if (data) {
        parmas = data;
      }
      listPage(parmas).then((res) => {
        const tableData = res.data;
        // 过滤待失效数据
        res.data.forEach((item, index) => {
          if (item.noticeState === "7") {
            console.log(item, "----item");
            tableData.splice(index, 1);
            // 处理过滤后列表总数
          }
        });
        console.log(tableData);
        tableData.forEach((item) => {
          item.approvalDept = item.approvalDept === null ? item.approvalDept : (item.approvalDept).includes("司") ? item.approvalDept.split("司")[0] + "司" : item.approvalDept;
          item.contact = (item.contact).replace(/,/g, "、");
        });
        this.$set(this.config.table, "tableData", tableData);
        // this.$set(this.config.table, "tableData", res.data);
        this.$set(this.config.table.paginationAtrrs, "total", Number(res.total));
        console.log(this.config.table.tableData, "??????????????????tableData");
      });
    },
    // 详情接口
    getDetail(val) {
      detailList({ id: val }).then(res => {

        this.infoId = res.infoId;
        this.infoIds = res.infoIds;
        this.noticeState = res.noticeState;
        this.judgeId = res.judgeId;
        this.$nextTick(() => {
          this.rangeInfo = res.rangeDetailVos;
          const effectRange = [];
          const geo = [];
          res.rangeDetailVos.map(item => {
            effectRange.push(item.effectRange);
            geo.push(item.geo);
          });
          this.$set(this.$refs.formComponent.form, "effectRange", effectRange);
          this.$set(this.$refs.formComponent.form, "geo", geo);
          this.$set(this.config.table1, "tableData", res.warningMeasureDetailVos);
          this.$set(this.$refs.formComponent.form, "warningNoticeName", res.warningNoticeName);
          // this.$set(this.$refs.formComponent.form, "effectRange", res.effectRange);
          this.$set(this.$refs.formComponent.form, "dangerName", res.dangerName);
          this.$set(this.$refs.formComponent.form, "dangerCode", Number(res.dangerCode));
          this.$set(this.$refs.formComponent.form, "warningLvName", res.warningLvName);
          this.$set(this.$refs.formComponent.form, "warningLvCode", Number(res.warningLvCode));
          // this.$set(this.$refs.formComponent.form, "effectRange", res.effectRange);
          this.$set(this.$refs.formComponent.form, "effectStartTime", res.effectStartTime);
          this.$set(this.$refs.formComponent.form, "effectEndTime", res.effectEndTime);
          this.$set(this.$refs.formComponent.form, "eventOutline", res.eventOutline);
          this.$set(this.$refs.formComponent1.form, "unitName", res.unitName.split("、") || []);
          this.$set(this.$refs.formComponent1.form, "unitId", res.unitId.split("、") || []);
          this.$set(this, "id", res.id);
          this.$set(this.$refs.formComponent1.form, "deptName", res.deptName.split("、") || []);
          this.$set(this.$refs.formComponent1.form, "deptId", res.deptId.split("、") || []);
          this.$set(this.$refs.formComponent1.form, "contact", res.contact.split(","));
          this.$set(this.$refs.formComponent1.form, "contactId", res.contactId.split(","));
          this.$set(this.$refs.formComponent1.form, "outTheNewspaper", res.outTheNewspaper);
          this.$set(this.$refs.formComponent1.form, "newspaperId", res.outTheNewspaper);// this.common.checkString(res.newspaperId)
          this.$set(this.$refs.formComponent1.form, "sendDuplicate", res.sendDuplicate);
          this.$set(this.$refs.formComponent1.form, "sendDuplicateId", res.sendDuplicate);// this.common.checkString(res.sendDuplicateId)
          this.$set(this.$refs.formComponent2.form, "creator", res.creator);
          this.$set(this.$refs.formComponent2.form, "createDeptName", res.createDeptName);
          this.$set(this.$refs.formComponent2.form, "createTime", res.createTime);
          console.log(this.$refs.formComponent1.form, "????this.$refs.formComponent1.form");
          if (this.dialogConfig.type === "tz") {
            this.$set(this.$refs.formComponent.form, "adjustExplain", "");
          } else if (this.dialogConfig.type === "bj") {
            this.$set(this.$refs.formComponent.form, "adjustExplain", res.adjustExplain);
          }
          if (this.dialogConfig.type === "sp") {
            const rangeDetailVos = res.rangeDetailVos.map(item => {
              return item.effectRange;
            });
            this.$set(this.$refs.formComponent.form, "adjustExplain", res.adjustExplain);
            this.$set(this.$refs.formComponent.form, "effectRange", rangeDetailVos.join("、"));
            this.$set(this.$refs.formComponent1.form, "deptName", res.deptName);
            this.$set(this.$refs.formComponent1.form, "deptId", res.deptId);
            this.$set(this.$refs.formComponent1.form, "unitName", res.unitName);
            this.$set(this.$refs.formComponent1.form, "unitId", res.unitId);
            this.$set(this.$refs.formComponent1.form, "contact", res.contact);
            this.$set(this.$refs.formComponent1.form, "contactId", res.contactId);
            this.$set(this.$refs.formComponent3.form, "approvalOpinion", "");
            this.$set(this.$refs.formComponent3.form, "approvalUser", res.approvalUser || JSON.parse(sessionStorage.getItem("account")).realName);
            this.$set(this.$refs.formComponent3.form, "approvalDept", res.approvalDept || sessionStorage.getItem("dwbmName"));
            this.$set(this.$refs.formComponent3.form, "approvalTime", res.approvalTime || new Date().toLocaleString());
          } else if (this.dialogConfig.type === "jc") {
            const rangeDetailVos = res.rangeDetailVos.map(item => {
              return item.effectRange;
            });
            this.$set(this.$refs.formComponent.form, "adjustExplain", res.adjustExplain);
            this.$set(this.$refs.formComponent.form, "effectRange", rangeDetailVos.join("、"));
            this.$set(this.$refs.formComponent1.form, "deptName", res.deptName);
            this.$set(this.$refs.formComponent1.form, "deptId", res.deptId);
            this.$set(this.$refs.formComponent1.form, "unitName", res.unitName);
            this.$set(this.$refs.formComponent1.form, "unitId", res.unitId);
            this.$set(this.$refs.formComponent1.form, "contact", res.contact);
            this.$set(this.$refs.formComponent1.form, "contactId", res.contactId);
          }
        });
        getIssueJudgeData({ id: res.judgeId }).then(data => {
          this.number = data.number;
        });
      });
    },
    // 调用按钮对应方法
    onActionClick(item, index) {
      this[item.id]();
    },
    // 列表跳预警通知单
    detailList(row) {
      this.$router.push({
        name: "NoticeDetail",
        query: { id: row.id }
      });
    },
    // 列表页时间选择事件
    change(val) {
      this.form.effectStartTime = val[0];
      this.form.effectEndTime = val[1];
    },
    // 弹窗关闭
    close(val) {
      val.isShow = false;
      if (this.$route.query.type == 1 || this.$route.query.type == 2) {
        if (this.$route.query.noticeState) {
          this.$router.push({
            name: "NoticeList",
            query: {
              noticeState: 3
            }
          });
        } else {
          this.$router.push({
            name: "NoticeList",
            query: {
              noticeState: 3
            }
          });
        }
      } else {
        // this.$router.push({ query: {} });
      }
    },
    // 提交
    submit() {
      this.save("submit");
    },
    // 同意
    agree() {
      this.save("agree");
    },
    // 驳回
    rejected() {
      this.save("rejected");
    },
    // 保存/调整/提交
    save(val) {
      this.$refs.formComponent.isValidate();
      this.$refs.formComponent1.isValidate();
      const flag = this.$refs.formComponent.flag;
      const flag1 = this.$refs.formComponent1.flag;
      let emptFlag = true;
      const newTableData = this.config.table1.tableData;
      newTableData.forEach((item, index) => {
        if (item.measureRequire === "" || item.measureRequire === null || item.measureRequire === undefined) {
          this.$message({
            message: `有关措施要求列表，第${index + 1}条有关措施要求不能为空`,
            type: "error"
          });
          emptFlag = false;
        } else if (item.unitDeptId === "" || item.unitDeptId === null || item.unitDeptId === undefined) {
          this.$message({
            message: `有关措施要求列表，第${index + 1}条责任单位/部门不能为空`,
            type: "error"
          });
          emptFlag = false;
        }
      });
      if (flag && flag1 && emptFlag) {
        const parmas = {
          judgeId: this.judgeId,
          infoId: this.infoId,
          infoIds: this.infoIds,
          warningNoticeName: this.$refs.formComponent.form.warningNoticeName,
          dangerName: this.$refs.formComponent.form.dangerName,
          dangerCode: this.$refs.formComponent.form.dangerCode,
          warningLvName: this.$refs.formComponent.form.warningLvName,
          warningLvCode: this.$refs.formComponent.form.warningLvCode,
          rangeInfo: this.rangeInfo,
          effectStartTime: this.$refs.formComponent.form.effectStartTime,
          effectEndTime: this.$refs.formComponent.form.effectEndTime,
          adjustExplain: this.$refs.formComponent.form.adjustExplain,
          eventOutline: this.$refs.formComponent.form.eventOutline,
          unitName: this.$refs.formComponent1.form.unitName instanceof Array ? this.$refs.formComponent1.form.unitName.join("、") : this.$refs.formComponent1.form.unitName,
          unitId: this.$refs.formComponent1.form.unitId instanceof Array ? this.$refs.formComponent1.form.unitId.join("、") : this.$refs.formComponent1.form.unitId,
          deptName: this.$refs.formComponent1.form.deptName instanceof Array ? this.$refs.formComponent1.form.deptName.join("、") : this.$refs.formComponent1.form.deptName,
          deptId: this.$refs.formComponent1.form.deptId instanceof Array ? this.$refs.formComponent1.form.deptId.join("、") : this.$refs.formComponent1.form.deptId,
          contact: this.$refs.formComponent1.form.contact instanceof Array ? this.$refs.formComponent1.form.contact.join() : this.$refs.formComponent1.form.contact,
          contactId: this.$refs.formComponent1.form.contactId instanceof Array ? this.$refs.formComponent1.form.contactId.join() : this.$refs.formComponent1.form.contactId,
          outTheNewspaper: this.$refs.formComponent1.form.outTheNewspaper instanceof Array ? this.$refs.formComponent1.form.outTheNewspaper.join() : this.$refs.formComponent1.form.outTheNewspaper,
          // newspaperId: this.$refs.formComponent1.form.newspaperId.join(),
          sendDuplicate: this.$refs.formComponent1.form.sendDuplicate instanceof Array ? this.$refs.formComponent1.form.sendDuplicate.join() : this.$refs.formComponent1.form.sendDuplicate,
          // sendDuplicateId: this.$refs.formComponent1.form.sendDuplicateId.join(),
          creator: this.$refs.formComponent2.form.creator,
          createDeptName: this.$refs.formComponent2.form.createDeptName,
          createTime: this.$refs.formComponent2.form.createTime,
          measureUpdDtos: this.config.table1.tableData, // 有关措施与要求
          id: this.id,
          noticeState: this.noticeState
        };
        // 提交
        if (val === "submit") {
          parmas.number = this.number;
          parmas.type = 0;

          adjustSubmit(parmas).then((res) => {
            if (res) {
              // this.$message({
              //   message: "提交成功",
              //   type: "success"
              // });
              // this.getList();
              // this.dialogConfig.isShow = false;
              this.gzlSubmit(res, parmas);
            }
          });
        } else if (val === "agree") {
          parmas.approveSign = "pass";
          parmas.approvalOpinion = this.$refs.formComponent3.form.approvalOpinion ? this.$refs.formComponent3.form.approvalOpinion : "同意";
          parmas.approvalUser = this.$refs.formComponent3.form.approvalUser;
          parmas.approvalDept = this.$refs.formComponent3.form.approvalDept;
          parmas.approvalTime = this.$refs.formComponent3.form.approvalTime;
          // parmas.unitName = this.$refs.formComponent1.form.unitName;
          // parmas.unitId = this.$refs.formComponent1.form.unitId;
          // parmas.deptName = this.$refs.formComponent1.form.deptName;
          // parmas.deptId = this.$refs.formComponent1.form.deptId;
          warningNotificationApprove(parmas).then((res) => {
            if (res) {
              this.gzlAudit(3, parmas);
              // this.$message({
              //   message: "审核成功",
              //   type: "success"
              // });
              // this.getList();
              // this.dialogConfig.isShow = false;
            }
          });
        } else if (val === "rejected") {
          parmas.approveSign = "reject";
          parmas.approvalOpinion = this.$refs.formComponent3.form.approvalOpinion ? this.$refs.formComponent3.form.approvalOpinion : "驳回";
          parmas.approvalUser = this.$refs.formComponent3.form.approvalUser;
          parmas.approvalDept = this.$refs.formComponent3.form.approvalDept;
          parmas.approvalTime = this.$refs.formComponent3.form.approvalTime;
          // parmas.unitName = this.$refs.formComponent1.form.unitName;
          // parmas.unitId = this.$refs.formComponent1.form.unitId;
          // parmas.deptName = this.$refs.formComponent1.form.deptName;
          // parmas.deptId = this.$refs.formComponent1.form.deptId;
          warningNotificationAdjustApprove(parmas).then((res) => {
            if (res) {
              this.gzlAudit(4, parmas);

            }
          });
        } else {
          // 调整
          if (this.dialogConfig.type === "tz") {
            parmas.type = 0;
            adjust(parmas).then((res) => {
              if (res) {
                this.$message({
                  message: "保存成功",
                  type: "success"
                });
                this.getList();
                this.dialogConfig.isShow = false;
              }
            });
          } else if (this.dialogConfig.type === "jc") {
            parmas.relieveTime = this.$refs.formComponent.form.relieveTime;
            parmas.relieveExplain = this.$refs.formComponent.form.relieveExplain;
            // parmas.deptName = this.$refs.formComponent1.form.deptName;
            // parmas.unitName = this.$refs.formComponent1.form.unitName;
            console.log(parmas);
            relieve(parmas).then(res => {
              if (res) {
                this.$message({
                  message: "解除成功",
                  type: "success"
                });
                this.getList();
                this.dialogConfig.isShow = false;
              }
            });
          } else {
            // 修改
            parmas.type = 0;
            warningNotificationUpdById(parmas).then((res) => {
              if (res) {
                this.$message({
                  message: "保存成功",
                  type: "success"
                });
                this.getList();
                this.dialogConfig.isShow = false;
              }
            });
          }
        }
      }
      if (!this.$router.query.noticeState) {
        // this.$router.push({ query: {} });
      }
    },
    // 取消
    cancel() {
      this.dialogConfig.isShow = false;
      if (this.$route.query.type == 1 || this.$route.query.type == 2) {
        if (this.$route.query.noticeState) {
          this.$router.push({
            name: "NoticeList",
            query: {
              noticeState: 3
            }
          });
        } else {
          this.$router.push({
            name: "NoticeList",
            query: {
              noticeState: 3
            }
          });
        }
      } else {
        // this.$router.push({ query: {} });
      }

    },
    // 删除
    delete(row) {
      this.$confirm("此操作将永久删除该条数据, 是否继续?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning"
      }).then(() => {
        const res = deleteById({
          id: row.row.id
        });
        if (res) {
          this.$message({
            message: "删除成功",
            type: "success"
          });
          this.getList();
        }
      })
        .catch(() => {
          this.$message({
            type: "info",
            message: "已取消删除"
          });
        });
    },

    actionHandle(item, row) {
      this.id = this.$route.query.id ? this.$route.query.id : row.row.id;
      // this.$refs.formComponent1.form.unitName = [];
      if (["调整", "编辑", "审批"].includes(item)) {
        console.log(item, "---item");
        this.dialogConfig.isShow = true;
        if (item === "调整") {
          this.getSelect();
          this.dialogConfig.type = "tz";
        } else if (item === "编辑") {
          this.dialogConfig.type = "bj";
        } else if (item === "审批") {
          this.dialogConfig.type = "sp";
        }
        this.dialogConfig.title = "预警通知单调整申请";
        if (["调整", "编辑"].includes(item)) {
          if (item === "调整") {
            this.dialogConfig.btnList = [
              {
                name: "提交",
                type: "primary",
                id: "submit",
                size: "mini"
              },
              // {
              //   name: "保存",
              //   id: "save",
              //   size: "mini"
              // },
              {
                name: "取消",
                id: "cancel",
                size: "mini"
              }
            ];
          } else {
            this.dialogConfig.btnList = [
              {
                name: "提交",
                type: "primary",
                id: "submit",
                size: "mini"
              },
              {
                name: "保存",
                id: "save",
                size: "mini"
              },
              {
                name: "取消",
                id: "cancel",
                size: "mini"
              }
            ];
          }
          this.titleConfig = [
            {
              title: "基本信息",
              name: "1",
              slot: "slot1"
            },
            {
              title: "措施要求",
              name: "2",
              slot: "slot2"
            },
            {
              title: "预警对象",
              name: "3",
              slot: "slot3"
            },
            {
              title: "填报信息",
              name: "4",
              slot: "slot4"
            }
          ];
          this.formConfig.formData = [
            {
              type: "input",
              label: "预警通知单",
              prop: "warningNoticeName",
              isDisabled: true,
              class: "sjgy",
              lableWidth: "120px"
            },
            {
              type: "select",
              label: "险情类别",
              dic: "dic_xqlb",
              name: "dangerName",
              prop: "dangerCode",
              class: "half",
              lableWidth: "120px",
              option: []
            },
            {
              type: "select",
              label: "预警级别",
              dic: "dic_yjjb",
              prop: "warningLvCode",
              name: "warningLvName",
              class: "half",
              lableWidth: "120px",
              option: []
            },
            {
              type: "selectTree",
              label: "影响范围",
              prop: "effectRange",
              name: "geo",
              keyWord: "keyWord",
              treeRef: "treeRef",
              clickClose: true,
              title: "影响范围选择",
              choose: false,
              ref: "tree_select2",
              class: "half",
              multiple: true,
              lableWidth: "120px",
              option: [],
              treeData: {
                data: [],
                checked: [],
                props: {
                  children: "children",
                  label: "extName",
                  value: "geo"
                }
              }
            },
            {
              type: "dataPicker",
              label: "影响时间",
              prop: "effectStartTime",
              start: "effectStartTime",
              end: "effectEndTime",
              class: "half",
              lableWidth: "120px",
              dateType: "datetimerange"
            },
            {
              label: "调整说明",
              type: "input",
              prop: "adjustExplain",
              class: "half",
              lableWidth: "120px"
            },
            {
              label: "事件概要",
              type: "textarea",
              autosize: true,
              prop: "eventOutline",
              class: "sjgy",
              lableWidth: "120px"
            }
          ];
          this.formConfig1.formData = [
            {
              type: "selectTree",
              label: "主送单位",
              prop: "unitName",
              name: "unitId",
              keyWord: "keyWord",
              treeRef: "treeRef",
              commonClick: true,
              clickClose: false,
              multiple: true,
              title: "主送单位选择",
              choose: false,
              ref: "tree_select",
              class: "sjgy",
              lableWidth: "120px",
              option: [],
              treeData: {
                data: [],
                default: ["1"],
                checked: [],
                props: {
                  children: "children",
                  label: "orgName",
                  value: "id"
                }
              }
            },
            // {
            //   type: "selectTree",
            //   label: "预警部门",
            //   prop: "deptName",
            //   name: "deptId",
            //   keyWord: "keyWord1",
            //   treeRef: "treeRef1",
            //   commonClick: true,
            //   clickClose: false,
            //   multiple: true,
            //   title: "预警部门选择",
            //   choose: false,
            //   ref: "tree_select1",
            //   class: "sjgy",
            //   lableWidth: "120px",
            //   option: [],
            //   treeData: {
            //     data: [],
            //     default: ["1"],
            //     checked: [],
            //     props: {
            //       children: "children",
            //       label: "orgName",
            //       value: "id"
            //     }
            //   }
            // },
            {
              type: "select",
              label: "预警部门",
              prop: "deptId",
              name: "deptName",
              filterable: true,
              multiple: true,
              isDisabled: false,
              class: "sjgy",
              lableWidth: "130px",
              option: []
            },
            {
              label: "联系人",
              type: "select",
              prop: "contactId",
              name: "contact",
              class: "sjgy",
              filterable: true,
              lableWidth: "120px",
              multiple: true,
              option: []
            },
            {
              label: "抄报",
              dic: "dic_cb",
              type: "input",
              prop: "outTheNewspaper",
              name: "newspaperId",
              class: "half",
              lableWidth: "120px",
              multiple: true,
              option: []
            },
            {
              label: "抄送",
              dic: "dic_cs",
              type: "input",
              prop: "sendDuplicate",
              name: "sendDuplicateId",
              class: "half",
              lableWidth: "120px",
              multiple: true,
              option: []
            }
          ];
          this.formConfig.rules = {
            // dangerCode: [
            //   { required: true, message: "请选择险情类别", trigger: "blur" }
            // ],
            // warningLvCode: [
            //   { required: true, message: "请选择预警级别", trigger: "blur" }
            // ],
            // effectRange: [
            //   { required: true, message: "请选择影响范围", trigger: "blur" }
            // ],
            // effectStartTime: [
            //   { required: true, message: "请选择影响时间", trigger: "blur" }
            // ],
            adjustExplain: [
              { required: true, message: "请输入调整说明", trigger: "blur" }
            ],
            eventOutline: [
              { required: true, message: "请输入事件概要", trigger: "blur" }
            ]
          };
          this.formConfig1.rules = {
            unitName: [
              { required: true, message: "请选择主送单位", trigger: "blur" }
            ],
            deptId: [
              { required: true, message: "请选择预警部门", trigger: "blur" }
            ],
            contactId: [
              { required: true, message: "请选择联系人", trigger: "blur" }
            ],
            outTheNewspaper: [
              { required: true, message: "请输入抄报", trigger: "change" }
            ],
            sendDuplicate: [
              { required: true, message: "请选择抄送", trigger: "change" }
            ]
          };
          this.getOrgTree();
          this.getUnitTree();
          this.$nextTick(() => {
            this.$set(this.$refs.formComponent.form, "effectRange", []);
            this.$set(this.$refs.formComponent.form, "geo", []);
          });
        } else if (["审批"].includes(item)) {
          this.dialogConfig.btnList = [
            {
              name: "同意",
              type: "primary",
              id: "agree",
              size: "mini"
            },
            {
              name: "驳回",
              id: "rejected",
              size: "mini"
            },
            {
              name: "取消",
              id: "cancel",
              size: "mini"
            }
          ];
          this.titleConfig = [
            {
              title: "基本信息",
              name: "1",
              slot: "slot1"
            },
            {
              title: "措施要求",
              name: "2",
              slot: "slot2"
            },
            {
              title: "预警对象",
              name: "3",
              slot: "slot3"
            },
            {
              title: "填报信息",
              name: "4",
              slot: "slot4"
            },
            {
              title: "审判信息",
              name: "5",
              slot: "slot5"
            }
          ];
          this.formConfig.formData = [
            {
              type: "input",
              label: "预警通知单",
              prop: "warningNoticeName",
              class: "sjgy",
              lableWidth: "120px",
              isDisabled: true
            },
            {
              type: "select",
              label: "险情类别",
              dic: "dic_xqlb",
              name: "dangerName",
              prop: "dangerCode",
              class: "half",
              lableWidth: "120px",
              isDisabled: true,
              option: []
            },
            {
              type: "select",
              label: "预警级别",
              dic: "dic_yjjb",
              prop: "warningLvCode",
              name: "warningLvName",
              class: "half",
              lableWidth: "120px",
              isDisabled: true,
              option: []
            },
            {
              type: "input",
              label: "影响范围",
              prop: "effectRange",
              class: "half",
              isDisabled: true,
              lableWidth: "120px"
            },
            {
              type: "dataPicker",
              label: "影响时间",
              prop: "effectStartTime",
              start: "effectStartTime",
              end: "effectEndTime",
              class: "half",
              lableWidth: "120px",
              dateType: "datetimerange",
              isDisabled: true
            },
            {
              label: "调整说明",
              type: "input",
              prop: "adjustExplain",
              class: "sjgy",
              lableWidth: "120px",
              isDisabled: true
            },
            {
              label: "事件概要",
              type: "textarea",
              prop: "eventOutline",
              class: "sjgy",
              lableWidth: "120px",
              isDisabled: true
            }
          ];
          this.formConfig1.formData = [
            {
              label: "主送单位",
              dic: "unit",
              type: "select",
              prop: "unitId",
              name: "unitName",
              class: "sjgy",
              lableWidth: "120px",
              multiple: true,
              isDisabled: true,
              option: []
            },
            {
              label: "预警部门",
              dic: "dept",
              type: "select",
              prop: "deptId",
              name: "deptName",
              class: "sjgy",
              lableWidth: "120px",
              multiple: true,
              isDisabled: true,
              option: []
            },
            {
              label: "联系人",
              type: "select",
              prop: "contactId",
              name: "contact",
              filterable: true,
              class: "sjgy",
              lableWidth: "120px",
              multiple: true,
              isDisabled: true,
              option: []
            },
            {
              label: "抄报",
              dic: "cb",
              type: "input",
              prop: "outTheNewspaper",
              name: "newspaperId",
              class: "half",
              lableWidth: "120px",
              multiple: true,
              isDisabled: true,
              option: []
            },
            {
              label: "抄送",
              dic: "cs",
              type: "input",
              prop: "sendDuplicate",
              name: "sendDuplicateId",
              class: "half",
              lableWidth: "120px",
              multiple: true,
              isDisabled: true,
              option: []
            }
          ];
          this.formConfig.rules = {};
          this.formConfig3.formData[0].isDisabled = false;
        }
        if (this.$route.query.id) {
          this.getDetail(this.$route.query.id);
        } else {
          this.getDetail(row.row.id);
        }
        this.getInputVal();
        this.getOrgTree();
        this.getSelect();
        this.Hdepartment();
      } else if (item === "解除") {
        this.dialogConfig.isShow = true;
        this.dialogConfig.type = "jc";
        this.dialogConfig.title = "预警通知单解除申请";
        this.dialogConfig.btnList = [
          {
            name: "提交",
            type: "primary",
            id: "save",
            size: "mini"
          },
          {
            name: "取消",
            id: "cancel",
            size: "mini"
          }
        ];
        this.titleConfig = [
          {
            title: "基本信息",
            name: "1",
            slot: "slot1"
          },
          {
            title: "措施要求",
            name: "2",
            slot: "slot2"
          },
          {
            title: "预警对象",
            name: "3",
            slot: "slot3"
          },
          {
            title: "填报信息",
            name: "4",
            slot: "slot4"
          }
        ];
        const formData = [
          {
            type: "input",
            label: "预警通知单",
            prop: "warningNoticeName",
            class: "sjgy",
            lableWidth: "120px",
            isDisabled: true
          },
          {
            type: "select",
            label: "险情类别",
            dic: "dic_xqlb",
            name: "dangerName",
            prop: "dangerCode",
            class: "half",
            lableWidth: "120px",
            option: [],
            isDisabled: true
          },
          {
            type: "select",
            label: "预警级别",
            dic: "dic_yjjb",
            prop: "warningLvCode",
            name: "warningLvName",
            class: "half",
            lableWidth: "120px",
            isDisabled: true
          },
          {
            type: "input",
            label: "影响范围",
            prop: "effectRange",
            class: "half",
            lableWidth: "120px",
            isDisabled: true
          },
          {
            type: "dataPicker",
            label: "影响时间",
            prop: "effectStartTime",
            start: "effectStartTime",
            end: "effectEndTime",
            class: "half",
            lableWidth: "120px",
            dateType: "datetimerange",
            isDisabled: true
          },
          {
            type: "dataPicker",
            label: "解除时间",
            prop: "relieveTime",
            class: "half",
            lableWidth: "120px",
            dateType: "datetime"
          },
          {
            label: "解除说明",
            type: "input",
            prop: "relieveExplain",
            class: "sjgy",
            lableWidth: "120px",
            isDisabled: false
          },
          {
            label: "事件概要",
            type: "textarea",
            prop: "eventOutline",
            class: "sjgy",
            lableWidth: "120px",
            isDisabled: true
          }
        ];
        const formData1 = [
          {
            label: "主送单位",
            dic: "dic_zsdw",
            type: "select",
            prop: "unitId",
            name: "unitName",
            class: "sjgy",
            lableWidth: "120px",
            option: [],
            isDisabled: true
          },
          {
            label: "预警部门",
            dic: "dic_yjbm",
            type: "select",
            prop: "deptId",
            name: "deptName",
            class: "sjgy",
            lableWidth: "120px",
            multiple: true,
            option: [],
            isDisabled: true
          },
          {
            label: "联系人",
            type: "select",
            prop: "contactId",
            name: "contact",
            filterable: true,
            class: "sjgy",
            lableWidth: "120px",
            multiple: true,
            option: [],
            isDisabled: true
          },
          {
            label: "抄报",
            type: "input",
            prop: "outTheNewspaper",
            name: "newspaperId",
            class: "half",
            lableWidth: "120px",
            multiple: true,
            option: [],
            isDisabled: true
          },
          {
            label: "抄送",
            type: "input",
            prop: "sendDuplicate",
            name: "sendDuplicateId",
            class: "half",
            lableWidth: "120px",
            multiple: true,
            option: [],
            isDisabled: true
          }
        ];
        this.$set(this.formConfig, "formData", formData);
        this.$set(this.formConfig1, "formData", formData1);
        this.formConfig3.formData[0].isDisabled = true;
        this.formConfig.rules = {
          relieveTime: [
            { required: true, message: "请选择解除时间", trigger: "blur" }
          ],
          relieveExplain: [
            { required: true, message: "请输入解除说明", trigger: "blur" }
          ]
        };
        this.formConfig1.rules = {};
        if (this.$route.query.id) {
          this.getDetail(this.$route.query.id);
        } else {
          this.getDetail(row.row.id);
        }
        this.getOrgTree();
        this.getUnitTree();
        this.getSelect();
        this.Hdepartment();
      } else if (item === "删除") {
        this.delete(row);
      } else if (item === "预览") {
        this.dialogConfig1.isShow = true;
      } else if (item === "转响应") {
        this.$router.push({
          name: "EmergencyList",
          query: {
            id: row.row.id,
            isShow: true,
            type: 2
          }
        });
      }
      // this.$router.push({ query: {} });
    },
    // 获取下拉框数据
    getInputVal() {
      this.formData.forEach((item) => {
        if (item.dic && item.label !== "发布单位") {
          getDictByGroup({ groupCode: item.dic }).then((res) => {
            const option = res.map((item) => {
              return {
                label: item.dicName,
                value: Number(item.dicCode)
              };
            });
            item.options = option;
          });
        } else if (item.elType === "lsdTree") {
          // getUnitTreeApi().then(res => {

          // });
          getSubclassUntilLists({ orgId: JSON.parse(sessionStorage.getItem("org")).orgId }).then(res => {
            this.$set(this.formData[5].treeData.attrs, "data", res);
          });
        }
      });
    },
    // 获取详情下拉数据
    getSelect() {
      this.formConfig.formData.forEach((item) => {
        if (item.dic) {
          getDictByGroup({ groupCode: item.dic }).then((res) => {
            const option = res.map((item) => {
              return {
                label: item.dicName,
                value: Number(item.dicCode)
              };
            });
            item.option = option;
          });
        }
      });
      // formComponent1
      this.formConfig1.formData.forEach((item) => {
        if (item.dic) {
          getDictByGroup({ groupCode: item.dic }).then((res) => {
            const option = res.map((item) => {
              return {
                label: item.dicName,
                value: item.dicCode
              };
            });
            item.option = option;
          });
        }
        if (item.label === "联系人") {
          getPersonApi({ orgId: JSON.parse(sessionStorage.getItem("org")).orgId }).then((res) => {
            const option = res.map((item) => {
              const phone = item.phone === null ? "" : `：(${item.phone})`;
              return {
                label: `${item.orgName}${item.realName}${phone}`,
                value: item.id
              };
            });
            item.option = option;
          });
        } else if (item.label === "预警部门") {
          getOrgDepartmentList({ orgId: JSON.parse(sessionStorage.getItem("org")).orgId }).then(res => {
            const option = res.map((item) => {
              return {
                label: `${item.orgName}`,
                value: item.id
              };
            });
            item.option = option;
          });
        }

      });
      console.log(
        this.formConfig1.formData,
        "?????????????????this.formConfig1.formData"
      );
    },
    // 获取新增里面的部门字典值
    async Hdepartment() {
      sameLeveltree({ accountId: JSON.parse(sessionStorage.getItem("account")).id }).then(res => {
        this.zrbmOption = res;
      });
    },
    // 重置
    reset() {
      this.form = this.$options.data().form;
      this.$refs.yjxdlb.paginationAtrrsInner["current-page"] = 1;
      this.getList();
    },
    // 平铺树结构
    flatTreeArr(arr) {
      return arr.reduce((acc, cur) => {
        if (Array.isArray(cur.children)) {
          const copyCur = { ...cur };
          delete copyCur.children;
          return acc.concat(copyCur, this.flatTreeArr(cur.children));
        } else {
          return acc.concat(cur);
        }
      }, []);
    },
    // 筛选
    query() {
      const parmas = {
        pageNum: this.config.table.paginationAtrrs["current-page"],
        pageSize: this.config.table.paginationAtrrs["page-size"],
        warningNoticeName: this.form.warningNoticeName,
        dangerCode: this.form.dangerCode,
        warningLvCode: this.form.warningLvCode,
        effectRange: this.form.effectRange,
        effectStartTime: this.form.yxsj ? this.form.yxsj[0] : "",
        effectEndTime: this.form.yxsj ? this.form.yxsj[1] : "",
        // approvalUnit: this.form.approvalUnit,
        flowKey: "warning_notification_001",
        createDeptId: this.form.approvalUnitId,
        approvalStartTime: this.form.approvalTime ? this.form.approvalTime[0] : "",
        approvalEndTime: this.form.approvalTime ? this.form.approvalTime[1] : "",
        noticeState: this.form.noticeState ? this.form.noticeState : this.$route.query.flowCode ? this.$route.query.flowCode : ""
      };
      this.getList(parmas);
    },
    // 分页
    handleSizeChange(val) {
      const data = {
        pageNum: val["current-page"],
        pageSize: val["page-size"],
        warningNoticeName: this.form.warningNoticeName,
        dangerCode: this.form.dangerCode,
        warningLvCode: this.form.warningLvCode,
        effectRange: this.form.effectRange,
        effectStartTime: this.form.yxsj ? this.form.yxsj[0] : "",
        effectEndTime: this.form.yxsj ? this.form.yxsj[1] : "",
        flowKey: "warning_notification_001",
        // approvalUnit: this.form.approvalUnit,
        createDeptId: this.form.approvalUnitId,
        approvalStartTime: this.form.approvalTime ? this.form.approvalTime[0] : "",
        approvalEndTime: this.form.approvalTime ? this.form.approvalTime[1] : "",
        noticeState: this.form.noticeState ? this.form.noticeState : this.$route.query.flowCode ? this.$route.query.flowCode : ""
      };
      this.getList(data);
    },
    // 影响时间限制
    pickerChange(val, item, num) {
      this.$nextTick(() => {
        if (
          this.$refs.formComponent.form.effectStartTime &&
          this.$refs.formComponent.form.effectEndTime
        ) {
          const start = +new Date(
            this.$refs.formComponent.form.effectStartTime
          );
          const end = +new Date(this.$refs.formComponent.form.effectEndTime);
          if (num === 1) {
            if (start > end) {
              this.$message({
                message: "开始时间不能大于结束时间",
                type: "error"
              });
              this.$set(this.$refs.formComponent.form, "effectStartTime", "");
            }
          } else {
            if (end < start) {
              this.$message({
                message: "结束时间不能小于开始时间",
                type: "error"
              });
              this.$set(this.$refs.formComponent.form, "effectEndTime", "");
            }
          }
        }
      });
    }
  }
};
</script>

<style lang="less" scoped>
@import "../../../assets/style/common.less";
@import "../../../assets/style/ComponentStyle.less";
@import "../../../assets/style/pop-upNotification.less";

:deep(.el-breadcrumb__inner.is-link) {
  font-weight: 100;
  color: #fff;
}

.EmergencyList :deep(.el-breadcrumb__item:last-child .el-breadcrumb__inner) {
  color: #3270ff;
}

.box {
  flex: 1;
  display: flex;
  flex-direction: column;
  margin-top: 15px;
  background-color: #fff;
  border-radius: 4px;
  padding: 10px;
  box-sizing: border-box;
}

// :deep(.el-select__tags-text) {
//   padding: 0 10px;
//   background-color: #b9cefa;
//   color: #000;
// }
:deep(.el-tag.el-tag--info) {
  background-color: rgba(185, 206, 250) !important;
  color: #333333 !important;
  border-radius: 0px !important;
  height: 25px;
  font-size: 15px !important;
  border: none !important;
}

:deep(.el-cascader .el-tag__close.el-icon-close) {
  background: none;
  font-size: 18px;
  color: #909399;
  margin-bottom: 8px;
}

:deep(.el-select .el-tag__close.el-icon-close) {
  background: none;
  font-size: 18px;
  margin-bottom: 8px;
}

:deep(.el-select .el-tag.el-tag--info .el-tag__close:hover) {
  color: #909399;
}

// :deep(.el-tag.el-tag--info) {
//   background-color: rgba(185, 206, 250) !important;
//   color: #000 !important;
//   border-radius: 0px !important;
//   height: 25px;
// }
:deep(.el-cascader--small) {
  width: 100% !important;
}

// :deep(.el-select .el-tag__close.el-icon-close::before) {
//   display: block;
//   transform: translate(0, 0.5px);
//   height: 16px;
//   width: 16px;
//   border-radius: 50px;
//   background: #c0c4cc;
//   color: #fff;
//   font-size: 12px;
// }
// :deep(.el-select .el-tag__close.el-icon-close) {
//   background: none;
//   font-size: 16px;
// }
</style>
